      COMPLEX*16 FUNCTION CUPB(H1,H2,ALPHA1,ALPHA2,BETA1,BETA2,
     1                         DEPB,RHOB,GRHOB,LHB,MX)
C
C     THIS FUNCTION COMPUTES THE INTEGRAL OF TWO BASIC DEPTH
C     FUNCTIONS OVER THE BOTTOM FROM DEPB(1) TO HB, WEIGHTED
C     BY THE BOTTOM DENSITY PROFILE RHOB
C
      IMPLICIT REAL*8 (A-H,O-Z)
      DIMENSION DEPB(MX),RHOB(MX),GRHOB(MX)
      COMPLEX*16  CEXIB
      COMPLEX*16  ALPHA1,ALPHA2,BETA1,BETA2
C
      COMMON /BLKEVN/ HB,CW,CB,FKW,FKB,ROHW,ROHB,ATEN
C
      LHBM1=LHB-1
C
      CUPB=DCMPLX(0.0,0.0)
C     
      IF(LHBM1 .LT. 1 ) GO TO 320
      DO 300 L=1,LHBM1
      Z1=DEPB(L)
      Z2=DEPB(L+1)
      CUPB=CUPB+CEXIB(H1,H2,Z1,Z2,DEPB(L),RHOB(L),GRHOB(L),
     1          ALPHA1,ALPHA2,BETA1,BETA2)
  300 CONTINUE
  320 CONTINUE
      Z1=DEPB(LHB)
      CUPB=CUPB+CEXIB(H1,H2,Z1,HB,DEPB(LHB),RHOB(LHB),GRHOB(LHB),
     1          ALPHA1,ALPHA2,BETA1,BETA2)
C
C
      RETURN
      END
